package test.core;

import java.math.BigDecimal;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import hyl.core.MyFun;
import hyl.core.fun.MyIS;

class MyIStest {
	@BeforeAll
	static void setUpBeforeClass() throws Exception {
	}
	@BeforeEach
	void setUp() throws Exception {
	}
	@AfterEach
	void tearDown() throws Exception {
	}
	@Test
	void test() {
		//fail("Not yet implemented");
	}
	@Test
	public void test4() {
		Object arr[]=	new Object [] {123,2.33,2f,1l,23d,new BigDecimal(2)};
		System.out.println("----------------------------------");
		for(Object s1:arr) {
			show( s1);
		}
		int b=88;
		show(b);
		show(234);

	}
	public void show(Object s1) {
		System.out.print(s1.toString()); 
		String s=null;
		if (s1 instanceof Integer)
			s="Integer"; 
		else if (s1 instanceof Long)
			s="Long"; 
		else if (s1 instanceof Float)
			s="Float"; 
		else if (s1 instanceof Double)
			s="Double"; 
		else if (s1 instanceof BigDecimal)
			s="Decimal"; 
		System.out.println(s);
	}
	@Test
	public void test1() {
		String arr[]=	new String [] {"+29.33"," +29.33"," -29.33","29.33","29.3.3",".929.33"
				,".92933","a29","1,029.00","0.00","123456789012345.6789","+1234567890123456789","32425798",
				"32425.798","123456789012.34567","123456789012345678","-",".",",","0"};
		for(String s:arr) {
			System.out.println(s+"="+MyFun.str2Num(s)); 
		}System.out.println("----1----"); 
		for(String s:arr) {
			System.out.println(s+":"+MyIS.isNumStr(s)); 
			}

	}
	public void test2() {
		System.out.println("----2----"); 
		//MyFun.obj2Num(obj)
	}
	
}
